package com.ch.http.v1.impl;


import com.ch.http.v1.*;

import javax.servlet.annotation.WebServlet;
import java.io.PrintWriter;

@WebServlet("/login.s")

public class LoginServlet extends HttpServletImp {

    public void doGet(HttpServletRequest request, HttpServletResponse response){
        String name = request.getParameter("name");
        String pwd = request.getParameter("pwd");
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        if("yc".equals(name) && "123".equals(pwd)){
            HttpSession session = request.getSession();
            session.setAttribute("myinfo",name);
            out.append("用户登录成功!");
        } else {
            out.append("用户名或密码错误");
        }
    }
}
